/**
 * 函数生成器, Generator
 */

function* test() {
  console.log("进来");
  yield "fool";
  const res = yield "vv";
  console.log("第一", res);
   yield "gg";
  try {
    yield "wo";
  } catch (error) {
    console.log("第2", error);
  }
}

const ad = test();
console.log("第3", ad);
const ad2 = ad.next();
console.log("第4", ad2);
const ad3 = ad.next("我是谁");
console.log("哈哈",ad3)
const ad4 = ad.next("我是谁2");
console.log("哈哈2",ad4)
// ad.throw(new Error("没大会上的"));
